class Person {
    name:string
    age:number
    constructor(name:string, age:number) {
        this.name=name
        this.age=age
    }
    getname(){
        console.log(this.name)
    }
}
let p:Person = new Person('aa',12)
p.getname()
console.log(p)

class Student extends Person{
    height:number
    constructor(name:string,age:number,height:number) {
        super(name,age);
        this.height=height
    }
    getName() {
        super.getname();
    }
}
let a: Student = new Student('cc',22,100)
a.getName()

class code {
    public name:string
    protected age:number
    private height:number
    // readonly 只读修饰符，只读，即只能在初始化时赋值，并且不能再修改。
    constructor(name:string, age:number,height:number) {
        this.name=name
        this.age=age
        this.height=height
    }
    getHeight(){
        console.log(this.height)
    }
}
let a1:code=new code('bv',13,120)